import { createI18n } from 'vue-i18n'

const messages = {
  zh: {
    app: { title: '用户中心', logout: '退出' },
    login: { title: '登录', username: '用户名', password: '密码', submit: '登录' },
    users: {
      list: '用户列表', search: '搜索用户名/邮箱', add: '新增', edit: '编辑', remove: '删除', save: '保存', cancel: '取消',
      columns: { id: 'ID', username: '用户名', email: '邮箱' }
    },
    roles: {
      list: '角色列表', search: '搜索角色名称/编码', add: '新增', edit: '编辑', remove: '删除', save: '保存', cancel: '取消',
      columns: { id: 'ID', name: '角色名称', code: '角色编码', description: '描述' }
    },
    menus: {
      list: '菜单列表', search: '搜索菜单名称', add: '新增', edit: '编辑', remove: '删除', save: '保存', cancel: '取消',
      columns: { id: 'ID', name: '菜单名称', path: '路径', icon: '图标', sortOrder: '排序', visible: '可见' }
    },
    admins: {
      list: '管理员列表', search: '搜索用户名/昵称', add: '新增', edit: '编辑', remove: '删除', save: '保存', cancel: '取消',
      columns: { id: 'ID', username: '用户名', nickname: '昵称', enabled: '状态' }
    },
    tabs: { 
      refresh: '刷新', 
      close: '关闭', 
      closeOthers: '关闭其他',
      closeCurrent: '关闭当前',
      closeAll: '关闭全部'
    },
    pagination: {
      total: '共 {total} 条',
      pageSize: '条/页',
      goto: '前往',
      page: '页',
      prev: '上一页',
      next: '下一页',
      prevPages: '向前 5 页',
      nextPages: '向后 5 页'
    },
    breadcrumb: { 
      home: '首页',
      dashboard: '仪表板',
      users: '用户管理',
      roles: '角色管理',
      menus: '菜单管理',
      admins: '管理员管理'
    }
  },
  en: {
    app: { title: 'Users Center', logout: 'Logout' },
    login: { title: 'Login', username: 'Username', password: 'Password', submit: 'Sign in' },
    users: {
      list: 'Users', search: 'Search username/email', add: 'Add', edit: 'Edit', remove: 'Delete', save: 'Save', cancel: 'Cancel',
      columns: { id: 'ID', username: 'Username', email: 'Email' }
    },
    roles: {
      list: 'Roles', search: 'Search role name/code', add: 'Add', edit: 'Edit', remove: 'Delete', save: 'Save', cancel: 'Cancel',
      columns: { id: 'ID', name: 'Role Name', code: 'Role Code', description: 'Description' }
    },
    menus: {
      list: 'Menus', search: 'Search menu name', add: 'Add', edit: 'Edit', remove: 'Delete', save: 'Save', cancel: 'Cancel',
      columns: { id: 'ID', name: 'Menu Name', path: 'Path', icon: 'Icon', sortOrder: 'Sort Order', visible: 'Visible' }
    },
    admins: {
      list: 'Admins', search: 'Search username/nickname', add: 'Add', edit: 'Edit', remove: 'Delete', save: 'Save', cancel: 'Cancel',
      columns: { id: 'ID', username: 'Username', nickname: 'Nickname', enabled: 'Status' }
    },
    tabs: { 
      refresh: 'Refresh', 
      close: 'Close', 
      closeOthers: 'Close Others',
      closeCurrent: 'Close Current',
      closeAll: 'Close All'
    },
    pagination: {
      total: 'Total {total}',
      pageSize: '/ page',
      goto: 'Go to',
      page: 'page',
      prev: 'Previous',
      next: 'Next',
      prevPages: 'Previous 5 pages',
      nextPages: 'Next 5 pages'
    },
    breadcrumb: { 
      home: 'Home',
      dashboard: 'Dashboard',
      users: 'User Management',
      roles: 'Role Management',
      menus: 'Menu Management',
      admins: 'Admin Management'
    }
  }
}

const i18n = createI18n({ legacy: false, locale: localStorage.getItem('locale') || 'zh', messages })
export default i18n


